home *** CD-ROM | disk | FTP | other *** search
/ Mac-Source 1994 July / Mac-Source_July_1994.iso / C and C++ / Compilers⁄Interps / little-c / Ex6.c < prev    next >
C/C++ Source or Header  |  1993-10-04  |  368b  |  25 lines

  1. /* The loop statements. */
  2. main()
  3. {
  4.   int a;
  5.   char ch;
  6.   /* the while */
  7.   puts("Enter a number: ");
  8.   a = getnum();
  9.   while(a) {
  10.     print(a);
  11.     print(a*a);
  12.     puts("");
  13.     a = a - 1;
  14.   }
  15.   /* the do-while */
  16.   puts("enter characters, 'q' to quit");
  17.   do {
  18.     ch = getche();
  19.   } while(ch!='q');
  20.   /* the for */
  21.   for(a=0; a<10; a = a + 1) {
  22.     print(a);
  23.   }
  24. }
  25.